package com.zhou.spring.test_001;

/**
 * @author zhouyanxiang
 * @create 2020-07-2020/7/13-16:09
 */
public class CarFactory {
    public CarFactory(){
        super();
        System.out.println("car factory");
    }

    public static Car getCar(String name) throws Exception {
        if (name.equals("Audi")){
            return new Audi();
        }else if (name.equals("BWM")){
            return new BWM();
        }else {
            throw new Exception();
        }
    }


}
